From: Jan Beulich Date: Tue, 11 Sep 2012 13:55:33 +0000 (+0200) Subject: ns16550: PCI initialization adjustments X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~7938 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22man:///%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22man:/?a=commitdiff_plain;h=631126d92d7baa9d6a219aad27db2afeed05e392;p=xen.git ns16550: PCI initialization adjustments Besides single-port serial cards, also accept multi-port ones and such providing mixed functionality (e.g. also having a parallel port). Reading PCI_INTERRUPT_PIN before ACPI gets enabled generally produces an incorrect IRQ (below 16, whereas after enabling ACPI it frequently would end up at a higher one), so this is useful (almost) only when a system already boots in ACPI mode. Signed-off-by: Jan Beulich Acked-by: Keir Fraser --- diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 8ac6f630a4..4ea7128c60 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -468,7 +468,6 @@ static int __init check_existence(struct ns16550 *uart) static int pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx) { - uint16_t class; uint32_t bar, len; int b, d, f; @@ -479,9 +478,15 @@ pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx) { for ( f = 0; f < 0x8; f++ ) { - class = pci_conf_read16(0, b, d, f, PCI_CLASS_DEVICE); - if ( class != 0x700 ) + switch ( pci_conf_read16(0, b, d, f, PCI_CLASS_DEVICE) ) + { + case 0x0700: /* single port serial */ + case 0x0702: /* multi port serial */ + case 0x0780: /* other (e.g serial+parallel) */ + break; + default: continue; + } bar = pci_conf_read32(0, b, d, f, PCI_BASE_ADDRESS_0 + bar_idx*4); @@ -504,7 +509,8 @@ pci_uart_config (struct ns16550 *uart, int skip_amt, int bar_idx) uart->bar = bar; uart->bar_idx = bar_idx; uart->io_base = bar & ~PCI_BASE_ADDRESS_SPACE_IO; - uart->irq = 0; + uart->irq = pci_conf_read8(0, b, d, f, PCI_INTERRUPT_PIN) ? + pci_conf_read8(0, b, d, f, PCI_INTERRUPT_LINE) : 0; return 0; }